#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <functional>
#include <limits>
#include <iomanip>

using namespace std;

int n ,x ,y;
int title = 1;
int arr[1 << 10 + 1][1 << 10 + 1];
void tackle(int a, int b, int xx, int yy, int size)
{
    if(size == 1)
        return;
    int nsize = size / 2;
    int aaa = title++;
    if ((xx >= a && xx < a + nsize) && (yy >= b && yy < b + nsize))
    {
        tackle(a, b, xx, yy, nsize);
    }else 
    {
        arr[a + nsize - 1][b + nsize - 1] = aaa;
        tackle(a, b, a + nsize - 1, b + nsize - 1 , nsize);
    }


    if(xx >= a + nsize && xx < a + size && yy >= b && yy < b +nsize)
    {
        tackle(a, b + nsize, xx, yy, nsize);
    }else
    {
        arr[a + nsize - 1][b + nsize] = aaa;
        tackle(a, b + nsize, a + nsize - 1, b + nsize, nsize);
    }


    if(xx >= a && xx < a + nsize && yy >= b + nsize && yy < b + size)
    {
        tackle(a, b + nsize, xx, yy, nsize);
    }
    else
    {
        arr[a + nsize][b + nsize - 1] = aaa;
        tackle(a + nsize, b, a + nsize, b + nsize - 1, nsize);
    }

    if(xx >= a + nsize  && xx < a + size && yy >= b + nsize && yy < b + size)
    {
        tackle(a + nsize, b + nsize, xx, yy, nsize);
    }
    else{
        arr[a + nsize][b + nsize] = aaa;
        tackle(a + nsize, b + nsize, a + nsize, b + nsize, nsize);
    }
}

int main()
{
    cin >> n >> x >> y;
    
    for (int i = 1; i <= 1 << n;i++)
        for (int j = 1; j <= 1 << n;j++)
            arr[i][j] = -1;
    arr[x][y] = 0;
    tackle(1, 1, x, y, 1 << n);
    for (int i = 1; i <= 1 << n;i++)
        for (int j = 1; j <= 1 << n;j++)
        {
            cout << arr[i][j];
            if(i == 1 << n)
                cout << " ";
            else
                cout << endl;
        }
    return 0;
}